<?php
/**
 * This is the index.ctp of Property Controller
 * @author Gideon Amissah<kuulmek@yahoo.com>
 * @access public
 * @version 
 */

$prpGropOpt = array();
foreach($prpGroupData as $value){
    $prpGropOpt[$value['id']] = $value['group_name'];
}

$locOpt = array();
foreach($loc_data as $value){
    $locOpt[$value['id']] = $value['location_name'];
}


$loggedUser =  $this->Session->read('userSessionData');
$loggedUser_id = $loggedUser['id'];
$modified_date = date('Y-m-d H:i:s');
$created_date = date('Y-m-d H:i:s');

?>
<script type="text/javascript">
	var gblPrpGroup = <?php echo json_encode($jsonArr) ;?>;
    var gblPrpGroupData = <?php echo json_encode($prpGroupData) ;?>;
    var gblLocData = <?php echo json_encode($locOpt) ;?>;
    var gblLocAreaCodeData = <?php echo json_encode($loc_data) ;?>;
    var glb_next_auto_increment  = <?php echo json_encode($next_auto_increment) ;?>;
    var glb_reg_no_prefix  = <?php echo json_encode($reg_no_prefix) ;?>;
</script>
<div class="property-pane" >
   <div class="pane-header">
       Property
   </div>
   
   <table id="propertyflex" style="display:none;"></table>
   
   <div style="display: none;">
      <div id="property-item-form-window" class="form-window" style="width: 500px;">
    	<div class="property-item-prompt" ></div>
        <?php echo $this->Form->create('PropertyItem', array('default' => false, 'id' => 'property-item-form', 'action' => 'add','inputDefaults' => array('label' => false,'div' => false)));?>	
          <div class="content">
               <div class="row">
                    <div class="label">Property Group</div>
				    <div class="data">
                        <?php echo $this->Form->input('property_group_id', array( 'div' => false, 'label' => false, 'id'=>'property_group_id', 'options' => $prpGropOpt));?> 
                    </div>
               </div>
               <div class="row location_id">
                    <div class="label">Location</div>
				    <div class="data">
                    <?php echo $this->Form->input('location_id', array( 'div' => false, 'label' => false, 'id'=>'location_id', 'options' => $locOpt));?> 
                    </div>
               </div> 
               <div class="row loc_region">
                    <div class="label">Location Region</div>
				    <div class="data">
                    <?php echo $this->Form->input('loc_region', array( 'div' => false, 'label' => false, 'id'=>'loc_region', 'options' => array('North'=>'North','West'=>'West','South'=>'South','East'=>'East','Central'=>'Central')));?> 
                    </div>
               </div>
               <div class="row property_group_type_id">
                    <div class="label">Property Type</div>
				    <div class="data">
                        <?php echo $this->Form->input('property_group_type_id', array( 'div' => false, 'label' => false, 'id'=>'property_group_type_id', 'options' => array(0=>'')));?> 
                    </div>
                </div>
                <div class="row property_group_sub_type_id">
                    <div class="label">Property Sub Type</div>
				    <div class="data">
                        <?php echo $this->Form->input('property_group_sub_type_id', array( 'div' => false, 'label' => false, 'id'=>'property_group_sub_type_id', 'options' => array(0=>'')));?> 
                    </div>
                </div> 
                <div class="row property_reg_no">
                    <div class="label">Property Registration No:</div>
                    <div class="data"> 
                        <?php echo $this->Form->input('property_reg_no', array('type'=>'text', 'size'=>'30', 'div' => false, 'label' => false, 'id'=>'property_reg_no' ,'class' => '', 'value'=>'', 'readonly'=>'readonly')); ?>
                    </div>
                </div>
                <div class="row property_latitude">
                   <div class="label">Latitude</div>
                   <div class="data">
                       <?php echo $this->Form->input('latitude', array('type'=>'text', 'size'=>'30', 'div' => false, 'label' => false, 'id'=>'latitude' ,'class' => '', 'value'=>'')); ?>
                   </div>
                </div>
               <div class="row property_longitude">
                   <div class="label">Longitude</div>
                   <div class="data">
                       <?php echo $this->Form->input('longitude', array('type'=>'text', 'size'=>'30', 'div' => false, 'label' => false, 'id'=>'longitude' ,'class' => '', 'value'=>'')); ?>
                   </div>
               </div>
               <div class="row property_elevation">
                   <div class="label">Elevation</div>
                   <div class="data">
                       <?php echo $this->Form->input('elevation', array('type'=>'text', 'size'=>'30', 'div' => false, 'label' => false, 'id'=>'elevation' ,'class' => '', 'value'=>'')); ?>
                   </div>
               </div>
                <div class="row name">
                    <div class="label">Name of Property</div>
				    <div class="data">
                    <?php echo $this->Form->input('name', array('type'=>'text', 'size'=>'30', 'div' => false, 'label' => false, 'id'=>'name' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                 <div class="row private_property">
                    <div class="label">Private Property: </div>
                    <div class="data"> 
                        <?php echo $this->Form->input('PropertyItemDetail.private_property', array('type'=>'text', 'size'=>'30', 'div' => false, 'label' => false, 'id'=>'private_property' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                <div class="row identification">
                    <div class="label">Identification: </div>
                    <div class="data">
                        <?php echo $this->Form->input('PropertyItemDetail.identification', array('type'=>'text', 'size'=>'30', 'div' => false, 'label' => false, 'id'=>'identification' ,'class' => '', 'value'=>'')); ?> 
                    </div>
                </div>
                <div class="row year_of_establishment">
                    <div class="label">Year of Establishment</div>
				    <div class="data">
                    <?php echo $this->Form->input('PropertyItemDetail.year_of_establishment', array('type'=>'text', 'size'=>'30',  'div' => false, 'label' => false, 'id'=>'year_of_establishment' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                <div class="row type_of_business">
                    <div class="label">Type Of Business</div>
				    <div class="data">
                    <?php echo $this->Form->input('PropertyItemDetail.type_of_business', array('type'=>'text', 'size'=>'30',  'div' => false, 'label' => false, 'id'=>'type_of_business' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                <div class="row registration_no">
                    <div class="label">Business Registration No.</div>
				    <div class="data">
                    <?php echo $this->Form->input('PropertyItemDetail.registration_no', array('type'=>'text', 'size'=>'30',  'div' => false, 'label' => false, 'id'=>'registration_no' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                <div class="row dormant_business">
                    <div class="label">Dormant Business</div>
				    <div class="data">
                    <?php echo $this->Form->input('PropertyItemDetail.dormant_business', array('type'=>'text', 'size'=>'30',  'div' => false, 'label' => false, 'id'=>'dormant_business', 'options' => array('Active'=>'Active', 'Inactive'=>'Inactive')));?> 
                    </div>
                </div>
                <div class="row permit_no">
                    <div class="label">Permit No.</div>
				    <div class="data">
                      <?php echo $this->Form->input('PropertyItemDetail.permit_no', array('type'=>'text', 'size'=>'30',  'div' => false, 'label' => false, 'id'=>'permit_no' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                <div class="row store_no">
                    <div class="label">Store No.</div>
				    <div class="data">
                      <?php echo $this->Form->input('PropertyItemDetail.store_no', array('type'=>'text', 'size'=>'30',  'div' => false, 'label' => false, 'id'=>'store_no' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                 <div class="row no_rooms">
                    <div class="label">Number Of Rooms.</div>
				    <div class="data">
                      <?php echo $this->Form->input('PropertyItemDetail.no_rooms', array('type'=>'text', 'size'=>'30',  'div' => false, 'label' => false, 'id'=>'no_rooms' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div> 
                <div class="row date_approval">
                    <div class="label">Approval Date.</div>
				    <div class="data">
                      <?php echo $this->Form->input('PropertyItemDetail.date_approval', array('type'=>'text', 'div' => false, 'label' => false, 'id'=>'date_approval' ,'class' => 'date-picker', 'value'=>'')); ?>
                    </div>
                </div>
                <div class="row clasification">
                    <div class="label">Classification</div>
				    <div class="data">
                      <?php echo $this->Form->input('PropertyItemDetail.clasification', array('type'=>'text', 'size'=>'30',  'div' => false, 'label' => false, 'id'=>'clasification' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                <div class="row no_trained_teachers">
                    <div class="label">No. Trained Teachers</div>
				    <div class="data">
                      <?php echo $this->Form->input('PropertyItemDetail.no_trained_teachers', array('type'=>'text', 'size'=>'30',  'div' => false, 'label' => false, 'id'=>'no_trained_teachers' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                <div class="row no_nontrained_teachers">
                    <div class="label">No. Non Trained Teachers</div>
				    <div class="data">
                      <?php echo $this->Form->input('PropertyItemDetail.no_nontrained_teachers', array('type'=>'text', 'size'=>'30',  'div' => false, 'label' => false, 'id'=>'no_nontrained_teachers' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                <div class="row no_class_room">
                    <div class="label">No. Of Class Rooms</div>
				    <div class="data">
                      <?php echo $this->Form->input('PropertyItemDetail.no_class_room', array( 'type'=>'text', 'size'=>'30', 'div' => false, 'label' => false, 'id'=>'no_class_room' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                <div class="row no_students_per_class">
                    <div class="label">No. Of Students Per Class</div>
				    <div class="data">
                      <?php echo $this->Form->input('PropertyItemDetail.no_students_per_class', array( 'type'=>'text', 'size'=>'30', 'div' => false, 'label' => false, 'id'=>'no_students_per_class' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                <div class="row type_of_ownership">
                    <div class="label">Type Of Ownership</div>
				    <div class="data">
                    <?php echo $this->Form->input('type_of_ownership', array('type'=>'text', 'size'=>'30',  'div' => false, 'label' => false, 'id'=>'type_of_ownership' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                <div class="row owners_name">
                    <div class="label">Owners Name</div>
				    <div class="data">
                    <?php echo $this->Form->input('owners_name', array('type'=>'text', 'size'=>'30',  'div' => false, 'label' => false, 'id'=>'owners_name' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                <div class="row other_partners_name">
                    <div class="label">Other Partners Name</div>
				    <div class="data">
                    <?php echo $this->Form->input('other_partners_name', array('type'=>'text', 'size'=>'30',  'div' => false, 'label' => false, 'id'=>'other_partners_name' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                <div class="row house_no">
                    <div class="label">House No.</div>
				    <div class="data">
                    <?php echo $this->Form->input('house_no', array('type'=>'text', 'size'=>'30',  'div' => false, 'label' => false, 'id'=>'house_no' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                <div class="row address">
                    <div class="label">Address</div>
				    <div class="data">
                    <?php echo $this->Form->input('address', array( 'type'=>'text', 'size'=>'30', 'div' => false, 'label' => false, 'id'=>'address' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                <div class="row telephone">
                    <div class="label">Telephone</div>
				    <div class="data">
                    <?php echo $this->Form->input('telephone', array('type'=>'text', 'size'=>'30',  'div' => false, 'label' => false, 'id'=>'telephone' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                <div class="row business_no">
                    <div class="label">Business Tel:</div>
				    <div class="data">
                    <?php echo $this->Form->input('business_no', array('type'=>'text', 'size'=>'30',  'div' => false, 'label' => false, 'id'=>'business_no' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                <div class="row nationality">
                    <div class="label">Nationality</div>
				    <div class="data">
                    <?php echo $this->Form->input('nationality', array('type'=>'text', 'size'=>'30',  'div' => false, 'label' => false, 'id'=>'nationality' ,'class' => '', 'value'=>'Ghanaian')); ?>
                    </div>
                </div>
                <div class="row popular_area_name">
                    <div class="label">Popular Area Name</div>
				    <div class="data">
                    <?php echo $this->Form->input('popular_area_name', array('type'=>'text', 'size'=>'30',  'div' => false, 'label' => false, 'id'=>'popular_area_name' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                <div class="row street_name">
                    <div class="label">Street Name</div>
				    <div class="data">
                    <?php echo $this->Form->input('street_name', array('type'=>'text', 'size'=>'30',  'div' => false, 'label' => false, 'id'=>'street_name' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                <div class="row area_code">
                    <div class="label">Area Code</div>
				    <div class="data">
                    <?php echo $this->Form->input('area_code', array('type'=>'text', 'size'=>'30', 'div' => false, 'label' => false, 'id'=>'area_code' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div>
                <div class="row comment">
                    <div class="label">Comment</div>
				    <div class="data">
                    <?php echo $this->Form->input('comment', array('type'=>'textarea', 'div' => false, 'label' => false, 'id'=>'comment' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div> 
                <div class="row">
                   <div class="label">

                   </div>
                   <div class="data"> 
                      <button type="button" class="save" id="property-save-btn"><?php echo $this->Html->image('ico-49.gif', array('width' => '16', 'height' => '16', 'align' => 'left', 'border' => '0')); ?>&nbsp;Save</button>
                      <button type="button" class="cancel" id="property-cancel-btn"><?php echo $this->Html->image('ico-43.png', array('width' => '16', 'height' => '16', 'align' => 'left', 'border' => '0')); ?>&nbsp;Cancel</button>
                   </div>
                </div>
            </div>
        <?php echo $this->Form->end();?>
      </div>
    </div>
      
</div>

<?php
echo $this->element('property/view');
echo $this->Html->script('custom-scripts/property.js');
?>


<input type="hidden" id="table-url" value="<?php echo $this->Html->url(array('controller' => 'Property', 'action' => 'getPropertyList')); ?>" />
<input type="hidden" id="add-edit-url" value="<?php echo $this->Html->url(array('controller' => 'Property', 'action' => 'add')); ?>" />
<input type="hidden" id="load-url" value="<?php echo $this->Html->url(array('controller' => 'Property', 'action' => 'getProperty')); ?>" />
<input type="hidden" id="delete-url" value="<?php echo $this->Html->url(array('controller' => 'Property', 'action' => 'deleteProperty')); ?>" />
